package view.LoginRigister.Conponents;

import javax.swing.*;
import java.awt.*;

public class ContainerInputField extends JPanel {
    public JTextField UsernameField() {
        return usernameField;
    }

    public JPasswordField PasswordField() {
        return passwordField;
    }

    private final JTextField usernameField;
    private final JPasswordField passwordField;
    public ContainerInputField(){
        setLayout(new GridLayout(2,1));
        //setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
        JPanel userPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel userLabel = new JLabel("用户名:");
        usernameField = new JTextField(20);
        userPanel.add(userLabel);
        userPanel.add(usernameField);
        add(userPanel);

        JPanel passPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
        JLabel passLabel = new JLabel("密   码:");
        passwordField = new JPasswordField(20);
        passPanel.add(passLabel);
        passPanel.add(passwordField);
        add(passPanel);
    }
    public String getUsername(){
        return usernameField.getText();
    }
    public String getPassword(){
        return passwordField.getText();
    }

}
